﻿#region imports

using System;
using System.Text;
using System.ComponentModel;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Serialization;

using CondeNet.AssetManager.Business.Interface;

#endregion

namespace CondeNet.AssetManager.Business
{
    public class AssetContentRepository : IAssetContentRepository
    {
        #region properties

        [XmlElement ( "id" )]
        public int ID { get; set; }

        [XmlIgnore]
        public int AssetContentID { get; set; }

        [XmlIgnore]
        public int RepositoryID { get; set; }

        [XmlIgnore]
        public int StatusID { get; set; }

        [XmlElement ( "repository" )]
        public IRepository Repository { get; set; }
        
        [XmlElement ( "status" )]
        public IStatus Status { get; set; }
        
        //[XmlElement ( "assetcontent" )]
        //public IAssetContent AssetContent { get; set; }

        #endregion

        #region constructors

        public AssetContentRepository ( ) { }
        public AssetContentRepository ( int id, int assetContentId, int repositoryId, int statusId )
        {
            this.ID = id;
            this.AssetContentID = assetContentId;
            this.RepositoryID = repositoryId;
            this.StatusID = statusId;
        }
        public AssetContentRepository ( IAssetContentRepository entity )
        {
            this.ID = entity.ID;
            this.AssetContentID = entity.AssetContentID;
            this.RepositoryID = entity.RepositoryID;
            this.StatusID = entity.StatusID;
        }
        public AssetContentRepository ( IAssetContentRepository entity , IRepository repository )
        {
            this.ID = entity.ID;
            this.AssetContentID = entity.AssetContentID;
            this.RepositoryID = entity.RepositoryID;
            this.StatusID = entity.StatusID;
            this.Repository = repository;
        }
        public AssetContentRepository ( IRepository repository )
        {
            this.Repository = repository; 
        }

        #endregion

        #region overridden methods

        public override string ToString ( )
        {
            StringBuilder str = new StringBuilder ( );

            str.Append ( "-> ID: " + this.ID.ToString ( ) );
            str.Append ( "-> AssetContentID: " + this.AssetContentID.ToString ( ) );
            str.Append ( "-> RepositoryID: " + this.RepositoryID.ToString ( ) );
            str.Append ( "-> StatusID: " + this.StatusID.ToString ( ) );

            return str.ToString ( );
        }

        #endregion

    }
}
